<?php
/**
 * +----------------------------------------------------------------------
 * | 模型
 * +----------------------------------------------------------------------
 */
namespace app\common\model;

use think\helper\Str;

use think\Model;

class Fragment extends Model
{
    // 定义时间戳字段名
    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';

    // 一对一获取所属广告位
    public function files()
    {
        return $this->belongsTo(FilesPosition::class);
    }

    public function getDescriptionAttr($value,$data)
    {
        $description = Str::substr($data['content'],0,20);
        return $description;
    }



}